package com.jz.jingying.controller;


import com.jz.jingying.service.JingYingToJiayingService;
import com.jz.netthings.exception.AdscmSystemException;
import com.jz.netthings.support.SimpleCoreResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zyl
 * @since 2019-03-19
 */
@RestController
@RequestMapping("/adscm/sync/providerBaseInfo")
public class TProviderbaseinfoController {

    @Autowired
    JingYingToJiayingService jingYingToJiayingService;

    @RequestMapping("/syncProviderBaseInfo")
    public SimpleCoreResponse syncProviderBaseInfo() throws Exception {

//        jingYingToJiayingService.providerinfoDataImport();

//        new Thread(new Runnable() {
//            @Override
//            public void run() {
//                System.out.println("化检");
//                try {
//                    jingYingToJiayingService.providerinfoDataImport();
////                    jingYingToJiayingService.assayRecordDataImport();
//                } catch (Exception e) {
//                    e.printStackTrace();
//                }
//            }
//        }).start();
        new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("体检");
                try {
                    jingYingToJiayingService.bodyCheckDataImport();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }).start();
        new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("登记");
                jingYingToJiayingService.providerCollectionDataImport();
            }
        }).start();

//        jingYingToJiayingService.assayRecordDataImport();
//        jingYingToJiayingService.providerCollectionDataImport();
//        jingYingToJiayingService.providerCostDataImport();
        return new SimpleCoreResponse("200","同步成功" ,null);
    }
}

